﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PostSharp.Extensibility;

namespace PostSharp4ViewState
{
   public enum PersistMode
   {
      ViewState,
      ControlState
   }

   [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]   
   [Serializable]
   public sealed class PersistAttribute : Attribute, IRequirePostSharp
   {
      public PersistMode Mode { get; set; }
      
      #region IRequirePostSharp Members
      public PostSharpRequirements GetPostSharpRequirements()
      {
         PostSharpRequirements requirements = new PostSharpRequirements();
         requirements.PlugIns.Add("PostSharp4ViewState");
         requirements.Tasks.Add("PostSharp4ViewState.Weaver.PersistTask");
         return requirements;
      }
      #endregion
   }
}
